package com.irdstudio.tdp.console.api.rest;

import java.util.List;

import com.irdstudio.tdp.console.service.vo.PluginContentionConfVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.irdstudio.tdp.console.service.facade.PluginContentionConfService;
import com.irdstudio.sdk.beans.core.vo.ResponseData;
import com.irdstudio.sdk.ssm.web.AbstractController;

@RestController
@RequestMapping("/api")
public class PluginContentionConfController extends AbstractController  {
	
	@Autowired
	@Qualifier("pluginContentionConfServiceImpl")
	private PluginContentionConfService pluginContentionConfService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/plugin/contention/confs", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<PluginContentionConfVO>> queryPluginContentionConfAll(
			PluginContentionConfVO vo) {		
		List<PluginContentionConfVO> outputVo = pluginContentionConfService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/plugin/contention/conf/{pluginConfId}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<PluginContentionConfVO> queryByPk(@PathVariable("pluginConfId") String pluginConfId) {		
		PluginContentionConfVO inVo = new PluginContentionConfVO();
				inVo.setPluginConfId(pluginConfId);
		PluginContentionConfVO outputVo = pluginContentionConfService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param pluginContentionConf
	 * @return
	 */
	@RequestMapping(value="/plugin/contention/conf", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody PluginContentionConfVO inPluginContentionConfVo) {		
		int outputVo = pluginContentionConfService.deleteByPk(inPluginContentionConfVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inPluginContentionConfVo
	 * @return
	 */
	@RequestMapping(value="/plugin/contention/conf", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody PluginContentionConfVO inPluginContentionConfVo) {		
		int outputVo = pluginContentionConfService.updateByPk(inPluginContentionConfVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inPluginContentionConfVo
	 * @return
	 */
	@RequestMapping(value="/plugin/contention/conf", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertPluginContentionConf(@RequestBody PluginContentionConfVO inPluginContentionConfVo) {
		int outputVo = pluginContentionConfService.insertPluginContentionConf(inPluginContentionConfVo);
		return getResponseData(outputVo);
		
	}
}
